﻿using System;
using System.Web.Security;

namespace WebApplication1.UserRolerManagement
{
    public partial class Password_Recovery : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string uname = this.TextBox1.Text.Trim();
            if (Membership.FindUsersByName(uname).Count == 0)
            {
                string str1 = "用户名不存在！";
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script>alert('" + str1 + "');</script>");
            }
            else
            {
                string str2 = "密码重置成功！";
                Membership.FindUsersByName(uname)[uname].ChangePassword(Membership.FindUsersByName(uname)[uname].GetPassword(), "000000");
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script>alert('" + str2 + "');</script>");
            }
        }
    }
}
